<template>
  <el-drawer
    :title="translate('orderDetail')"
    :visible.sync="isShow"
    :wrapper-closable="!modalDialog"
    size="1000px"
  >
    <div class="property-title">{{ translate("orderinfo") }}</div>
    <div class="df_ac">
      <div class="item">
        <span class="key">{{ translate("orderNum") }}：</span>
        <span class="value">{{ detail.orderId }}</span>
      </div>
      <div class="item">
        <span class="key">{{ translate("orderStatus") }}：</span>
        <span>{{ detail.orderStatus }}</span>
      </div>
      <div class="item">
        <span class="key">{{ translate("orderTime") }}：</span>
        <span class="value">{{ detail.orderTime }}</span>
      </div>
      <div class="item">
        <span class="key">{{ translate("payTime") }}：</span>
        <span class="value">{{ detail.payTime }}</span>
      </div>
      <div class="item">
        <span class="key">{{ translate("orderPrice") }}：</span>
        <span
          class="value"
        >{{ translate("renminbi") }}{{ detail.orderPrice }}</span>
      </div>
      <div class="item">
        <span class="key">{{ translate("payMethod") }}：</span>
        <span class="value">{{ detail.payMethod || "-" }}</span>
      </div>
      <div class="item">
        <span class="key">{{ translate("payOrder") }}：</span>
        <span class="value">{{ detail.orderNum || "-" }}</span>
      </div>
      <div class="item">
        <span class="key">{{ translate("finishTime") }}：</span>
        <span class="value">{{ detail.finishTime || "-" }}</span>
      </div>
      <div class="item">
        <span class="key">{{ translate("refundPince") }}：</span>
        <span
          class="value"
        >{{ translate("renminbi") }}{{ detail.refundPrice || 0 }}</span>
      </div>
      <div class="item">
        <span class="key">{{ translate("refundUser") }}：</span>
        <span class="value">{{ detail.createUser }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">{{ translate("invoiceDesc") }}</div>
    <div class="df_ac">
      <div>
        <span class="key">{{ translate("invoiceStatus") }}：</span>
        <span class="value">{{
          detail.invoiceStatus == "1"
            ? translate("invoiceScs")
            : translate("invoiceNot")
        }}</span>
      </div>
      <div>
        <span class="key">{{ translate("invoiceTime") }}：</span>
        <span class="value">{{ detail.invoiceTime || "-" }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">{{ translate("buyerInfo") }}</div>
    <div class="df_ac mt20">
      <div>
        <span class="key">{{ translate("name") }}：</span>
        <span class="value">{{ detail.memberName || "-" }}</span>
      </div>
      <div>
        <span class="key">{{ translate("contactPhone") }}：</span>
        <span class="value">{{ detail.memberPhone || "-" }}</span>
      </div>
      <div>
        <span class="key">{{ translate("memberIdCard") }}：</span>
        <span class="value">{{ detail.memberId || "-" }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <el-table
      :data="detail.orderDetailList"
      border
      fit
      :header-row-class-name="'table-header'"
      class="doumee-element-table"
    >
      <el-table-column
        align="center"
        :label="translate('goodsName')"
        prop="productName"
        min-width="120"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        :label="translate('num')"
        prop="num"
        min-width="100"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        :label="translate('salesPriveUnit')"
        prop="price"
        min-width="100"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        :label="translate('subtotalUnit')"
        prop="sum"
        min-width="100"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        :label="translate('status')"
        prop="status"
        min-width="100"
        show-overflow-tooltip
      />
    </el-table>
    <div v-if="detail.detailMoneyRespParam" class="bottom_wrap">
      <div class="line">
        <span>{{ translate("orderPrice") }}：</span>
        <span>{{ detail.detailMoneyRespParam.orderPrice || 0 }}</span>
        <span>{{ translate("rmb") }}</span>
      </div>
      <template v-if="detail.detailMoneyRespParam">
        <div v-if="detail.detailMoneyRespParam.memberDiscount" class="line">
          <span>{{ translate("memberDis") }}：</span>
          <span>-</span>
          <span>{{ detail.detailMoneyRespParam.memberDiscount || 0 }}</span>
          <span>{{ translate("rmb") }}</span>
        </div>
        <div v-if="detail.detailMoneyRespParam.marketingPolicy" class="line">
          <span>{{ translate("marketing") }}</span>
          <span>-</span>
          <span>{{ detail.detailMoneyRespParam.marketingPolicy || 0 }}</span>
          <span>{{ translate("rmb") }}</span>
        </div>
        <div v-if="detail.detailMoneyRespParam.groupBuyCoupon" class="line">
          <span>{{ translate("groupCoupon") }}</span>
          <span>-</span>
          <span>{{ detail.detailMoneyRespParam.groupBuyCoupon || 0 }}</span>
          <span>{{ translate("rmb") }}</span>
        </div>
        <div v-if="detail.detailMoneyRespParam.discountCoupon" class="line">
          <span>{{ translate("disCoupon") }}</span>
          <span>-</span>
          <span>{{ detail.detailMoneyRespParam.discountCoupon || 0 }}</span>
          <span>{{ translate("rmb") }}</span>
        </div>
        <div v-if="detail.detailMoneyRespParam.integral" class="line">
          <span>{{ translate("integralDeduction") }}</span>
          <span>-</span>
          <span>{{ detail.detailMoneyRespParam.integral || 0 }}</span>
          <span>{{ translate("rmb") }}</span>
        </div>
      </template>
      <div class="line secondColor">
        <span>{{ translate("realPut") }}</span>
        <span>{{ detail.detailMoneyRespParam.getPrice || 0 }}</span>
        <span>{{ translate("rmb") }}</span>
      </div>
    </div>
  </el-drawer>
</template>

<script>
import store from '@/store'
import { momMOrderDetail } from '@/api'
export default {
  data() {
    return {
      isShow: false,
      detail: {},
      statusMap: {
        '0': this.translate('useStatus3'),
        '1': this.translate('useStatus5'),
        '2': this.translate('useStatus6'),
        '3': this.translate('zfcg'),
        '4': this.translate('useStatus7'),
        '5': this.translate('useStatus8')
      },
      modalDialog: store.getters.dialog
    }
  },
  methods: {
    getOrderDetail(id) {
      momMOrderDetail({ param: { id }}).then(res => {
        this.detail = { ...res.record }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.df_ac {
  flex-wrap: wrap;
  div {
    width: 33.33%;
    margin-bottom: 20px;
    .key {
      color: #666666;
      display: inline-block;
      // width: 90px;
      // text-align: right;
    }
    .value {
      color: #222;
    }
  }
}
.bottom_wrap {
  margin-top: 30px;
  text-align: right;
  .line {
    margin-bottom: 10px;
  }
}
</style>
